Difference between Greedy Reluctant Possessive and greedypossessive in Java Regular Expression
In the previous article, regular expressions in programming thoughts, the principles, usage methods, and common regular expressions of regular
In the previous article, "The regular expression of the idea of programming ," the principle of regular expression, the use of methods and the common regular expression summary, this article will further explore the Java regular expression greedy,
An understanding of possessive number modifiers in Java regular expressions the regular expression for the number qualifier such as, +, *, {n, m} matches by default is greedy mode, for example: a.*b match acbab result is acbab instead of ACB regular
1, Greediness (Greedy type):Maximum MatchX, x*, x+, X{n,} are allmaximum match. For example you want to use "" to Match "Aaavaabb", perhaps the result you expect is to match "", but the actual result will be matched to "aava ". What is this for?
The regular expression specifies the number of delimiters, Such ?, +, *, {N, m} matches the greedy mode by default, for example,. * The result of B matching acbab is that acbab instead of acb Regular Expressions support the lazy mode, that is, a
Suppose the string to be processed is Xfooxxxxxxfoomode. *foo (greedy mode):The pattern is divided into sub-mode P1 (. *) and sub-mode P2 (foo) two parts. The quantifier matching method in P1 uses the default (greedy type).When the match starts, eat
1. Go to Regexkitlite download class library, extract will have an example package and 2 files, in fact, the use of the 2 files, added to the project.2. Add Libicucore.dylib frameworks to the project.Friendly reminder: General people import
1. To Regexkitlite download class library, extract will have an example package and 2 files, in fact, the use of these 2 files, added to the project.
2. Add Libicucore.dylib frameworks to the project.
3. All NSString objects can now call methods in
Expression meaning:
1. Character
X characters x. For example, a indicates character.
\ Backslash character. When writing, enter \\\\. (Note: during the first parsing of java, \ is parsed into a regular expression \, and the second Parsing is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.